package org.zjx.app.action.login;


import org.zjx.analysis.analyze.login.LoginHomeAnalysis;
import org.zjx.window.action.Action;
import org.zjx.window.action.impl.DelayAction;
import org.zjx.window.window.IWindow;

import java.awt.*;

public class LoginHomeAction extends Action { // 在需要的时候才进行详细分析
    protected LoginHomeAnalysis loginHomeAnalysis;

    public LoginHomeAction(IWindow targetWindow) {
        super(targetWindow, false);
        loginHomeAnalysis = new LoginHomeAnalysis();
        loginHomeAnalysis.analyze(targetWindow.getScreenshot());
    }

    @Override
    protected void doExecute() throws Exception {
        Rectangle next = loginHomeAnalysis.getNextRectangle();
        targetWindow.clickIn(next);
        new DelayAction(targetWindow,1000);
    }
}
